**************************************************************************************
************************************************************************************** 
****                                                                              ****
**** The following STATA program files were used for the analysis in:             ****
****                                                                              ****
**** Wang, Y., Chen, S.*, Araral, E., 2021. The mediated effects of urban         ****
**** proximity on collective action in the commons: Theory and evidence from      ****
**** China. World Development 142, 105444.                                        ****
**** https://doi.org/10.1016/j.worlddev.2021.105444                               ****
**** Please kindly acknowledge us when publishing your work using this data       ****
**** source--be it in whole or in part.                                           ****
****                                                                              ****
**** Contact scchen@tsinghua.edu.cn if you have any questions concerning          ****
**** either the data  structure or programming.                                   ****
****                                                                              ****
**************************************************************************************
**************************************************************************************


use urbanproximitycommons.dta, clear


***table1, summary of data

estpost sum vica2 lprodist lprotime prodist prodist_tim topography lcolec lpopul midirrigtscar abunirrigtscar lm1 wua vpf1
esttab  using allsampletable.rtf, ///
cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3)) min(fmt(0)) max(fmt(0))")  ///
label nonumber noobs nomtitle ///
title({\b Table 1.} {\i Variable definition and descriptive statistics.})  /// 
replace 
eststo clear



***table2, determinants of maintenance status

eststo clear 
eststo: quietly oprobit vica2 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table 2.} {\i The determinants of maintenance status}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) 


***table3, Sobel-Goodman mediation test of determinants of maintenance status

sgmediation vica2, mv(topography) iv(lprodist) cv(midirrigtscar abunirrigtscar  lm1 vpf1 wua ah bj fj gs gd gx gz hain heb hen hlj hub hn jl js jx ln nmg nx qh sd shanx shaax sc xz xj yn zj cq   y13 y14 y15 y16)
sgmediation vica2, mv(lpopul) iv(lprodist) cv(midirrigtscar abunirrigtscar  lm1 vpf1 wua ah bj fj gs gd gx gz hain heb hen hlj hub hn jl js jx ln nmg nx qh sd shanx shaax sc xz xj yn zj cq  y13 y14 y15 y16)
sgmediation vica2, mv(lcolec) iv(lprodist) cv(midirrigtscar abunirrigtscar  lm1 vpf1 wua ah bj fj gs gd gx gz hain heb hen hlj hub hn jl js jx ln nmg nx qh sd shanx shaax sc xz xj yn zj cq  y13 y14 y15 y16)



***Table A2. Summing up all regression models

eststo clear 
eststo: quietly oprobit vica2 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist topography lcolec lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
esttab using tableall.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A2.} {\i Summing up all regression models}) ///
mtitles("Maintenance status""Topography"   "Population"   "Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) 



***tableA3, simple mediation models,vica2,ptim


eststo clear 
eststo: quietly oprobit vica2 lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)

esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A3.} {\i The determinants of maintenance status with time distance}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income"  "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua)



***tableA4, simple mediation models,vica3


eststo clear 
eststo: quietly oprobit vica3 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprodist topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprodist lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprodist lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A4.} {\i The determinants of Maintenance frequency}) ///
mtitles("Maintenance frequency""Topography"  "Maintenance frequency""Population"  "Maintenance frequency""Collective income"  "Maintenance frequency" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) 


***tableA5, simple mediation models,vica3,ptim


eststo clear 
eststo: quietly oprobit vica3 lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprotime topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprotime lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica3 lprotime lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A5.} {\i The determinants of Maintenance frequency with time distance}) ///
mtitles("Maintenance frequency""Topography"  "Maintenance frequency""Population"  "Maintenance frequency""Collective income"  "Maintenance frequency" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua)  




***tableA6, simple mediation models,vica2,ologit

eststo clear 
eststo: quietly ologit vica2 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly ologit vica2 lprodist topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lpopul lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly ologit vica2 lprodist lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lcolec lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly ologit vica2 lprodist lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)

esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A6.} {\i The determinants of maintenance status ologitmodel}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua)



***tableA7, simple mediation models,vica2,ptim,ologit


eststo clear 
eststo: quietly ologit vica2 lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly ologit vica2 lprotime topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lpopul lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly ologit vica2 lprotime lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lcolec lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly ologit vica2 lprotime lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)

esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table A7.} {\i The determinants of maintenance status with time distance ologitmodel}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua)



***tableA8, simple mediation models,vica2,all reg


eststo clear 
eststo: quietly reg vica2 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg vica2 lprodist topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lpopul lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg vica2 lprodist lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lcolec lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg vica2 lprodist lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)

esttab using allsampletable.rtf,append label nocon se r2 scalar(ll) title({\b Table A8.} {\i The determinants of maintenance status OLSmodel}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua)




***tableA9, simple mediation models,vica2,ptim,all reg



eststo clear 
eststo: quietly reg vica2 lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg vica2 lprotime topography midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lpopul lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg vica2 lprotime lpopul midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid  i.year,vce(r)
eststo: quietly reg lcolec lprotime midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg vica2 lprotime lcolec midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)

esttab using allsampletable.rtf,append label nocon se r2 scalar(ll) title({\b Table A9.} {\i The determinants of maintenance status with time distance OLSmodel}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprotime topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) 



***tableA10, simple mediation models,oprobit；different control;midscare abunscare lm2

eststo clear 
eststo: quietly oprobit vica2 lprodist midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprodist midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist topography midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprodist midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist lpopul midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprodist midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprodist lcolec midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)  
  esttab using allsampletable.rtf,append label nocon se r2 scalar(ll) title({\b Table A10.} {\i The determinants of maintenance status with different control}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist topography lpopul lcolec midscare abunscare  lm2 vpf1 wua) ///
keep(lprodist topography lpopul lcolec midscare abunscare  lm2 vpf1 wua) 



***tableA11, simple mediation models,oprobit；different control;ptime,midscare abunscare lm2

eststo clear 
eststo: quietly oprobit vica2 lprotime midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg topography lprotime midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime topography midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lpopul lprotime midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime lpopul midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly reg lcolec lprotime midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lprotime lcolec midscare abunscare lm2 vpf1 wua i.provid i.year,vce(r)  
  esttab using allsampletable.rtf,append label nocon se r2 scalar(ll) title({\b Table A11.} {\i The determinants of maintenance status with time distance with different control}) ///
mtitles("Maintenance status""Topography"  "Maintenance status""Population"  "Maintenance status""Collective income" "Maintenance status" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprotime topography lpopul lcolec midscare abunscare  lm2 vpf1 wua)  ///
keep(lprotime topography lpopul lcolec midscare abunscare  lm2 vpf1 wua) 




******table R1. The determinants of maintenance status with four distances

eststo clear 
eststo: quietly oprobit vica2 lprodist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2 lcitydist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2  lcountydist midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2  ltowndist  midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
eststo: quietly oprobit vica2  lprodist lcitydist lcountydist ltowndist  midirrigtscar abunirrigtscar  lm1 vpf1 wua i.provid i.year,vce(r)
esttab using allsampletable.rtf,append label nocon se r2 pr2 scalar(ll) title({\b Table R1.} {\i The determinants of maintenance status with four distances}) ///
mtitles("lprodist""lcitydist"  "lcountydist" "ltowndist""four distance" ) ///
 indicate("Province FX=*provid*""Year FX=*year*")  compress nogap starlevels(* 0.10 ** 0.05 *** 0.01) ///
order(lprodist lcitydist lcountydist ltowndist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) ///
keep(lprodist lcitydist lcountydist ltowndist topography lpopul lcolec  midirrigtscar abunirrigtscar  lm1 vpf1 wua) 








